<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>增加护理等级</title>
		<link rel="stylesheet" href="css/form-default.css" />
		<link rel="stylesheet" href="css/input.css" />
	</head>

	<body>
		<article>
			<form class="label5em" @submit.prevent="add">
				<p><label>等级:</label><input v-model="params.level" type="text"></p>
				<p><label>名称:</label><input v-model="params.name" type="text"></p>
				<p><label>护理内容:</label><input v-model="params.content" type="text"></p>
				<p>
					<button :disabled="actionBtnDisabled">确定</button>
				</p>
			</form>
		</article>
		<script src="../../common/vue.js"></script>
		<script src="../../common/jun/yi.shakeit.js"></script>
		<script src="../../common/axios.min.js"></script>
		<script src="../../common/jun/yi.toast.js"></script>
		<script>
			const vm = new Vue({
				el: "body>article",
				data: {
					params: {},
					resp: {
						massage: null
					},
					actionBtnDisabled: false
				},
				methods: {
					"add": function() {
						this.acactionBtnDisabled = true;
						axios.post("http://127.0.0.1:8080/api/level", this.params)
							.then(function(resp) {
								if(resp.code === "ok") {
									toast("增加成功,返回等级界面");
									setTimeout(function() {
										location.href = "level.html"
									}, 1000);
								} else {
									toast(resp.message);
								}
							}).finally(function() {
								vm.actactionBtnDisabled = false;
							});
					}
				}
			});
		</script>
	</body>

</html>